package com.example.user3.demo.pattern;

public class Student {
    private String name;
    private int age;
    private String address;
    private String id;
    private Student(Builder builder) {
        this.name = builder.name;
        this.age = builder.age;
        this.address = builder.address;
        this.id = builder.id;
    }

    public static class Builder{
        private String name = null;
        private int age = 0;
        private String address = null;
        private String id = null;


        public Builder() {

        }

        public Builder setName(String name) {
            this.name = name;
            return this;
        }

        public Builder setAddress(String address) {
            this.address = address;
            return this;
        }

        public Builder setId(String id) {
            this.id = id;
            return this;
        }
        public Student build() {
            return new Student(this);
        }

    }

    public static void main(String[] args) {
        Student student=new Student.Builder().build();
    }

}
